﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Elf.ServiceModel;
using Elf.Sample.Service;
using System.ServiceModel;
using Elf.Common;
using Elf.ServiceModel.Interfaces;
using Elf.Sample.ConsoleClient;
using Castle.MicroKernel.Registration;

namespace ConsoleClient
{
    class Program
    {
        static void Main(string[] args)
        {
            // Using your own WCF Interceptor
            DependencyFactory.Instance.Container.Register(Component.For<IWcfInterceptor<IDataService>>().ImplementedBy<CustomWcfInterceptor>());
            // Using your own WCF Client Invoker
            DependencyFactory.Instance.Container.Register(Component.For<IWcfClientInvoker>().ImplementedBy<CustomWcfClientInvoker>());


            Console.WriteLine("Calling method 'DoWork'...");
            try
            {
                ServiceClient<IDataService>.Instance.Proxy.DoWork();
            }
            catch (Exception)
            {
                Console.WriteLine("Exception was thrown...");
            }
            Console.WriteLine("Calling method 'ReturnString'...");
            Console.WriteLine(string.Format("Return value: {0}", ServiceClient<IDataService>.Instance.Proxy.ReturnString("It works...")));
            Console.WriteLine("Done...");
            Console.WriteLine("Press any key to exit...");
            Console.Read();
        }
    }
}
